package utils

// 类型转换
import (
	"fmt"
	"strconv"
)

// SliceString2Int64 字符串切片转成int64切片
func SliceString2Int64(arrays []string) []int64 {
	var newArrays []int64
	for _, itemStr := range arrays {
		item, err := strconv.ParseInt(itemStr, 10, 64)
		if err == nil {
			newArrays = append(newArrays, item)
		}
	}
	return newArrays
}

// SliceInt642String int64切片转成字符串切片
func SliceInt642String(arrays []int64) []string {
	var newArrays []string
	for _, itemI := range arrays {
		item := fmt.Sprintf("%d", itemI)
		newArrays = append(newArrays, item)
	}
	return newArrays
}
